<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>_点收确认</title>
<script type="text/javascript">
//完成点收
  function finish(){
      
     $("#finish_btn").attr("disabled",true);
	  $.ajax({
			type:'post',
			url:'${ctx}/v2_instorageCount/ajaxFinishCount',
			data:{
				taskCode:'${task.taskCode}',
				billCode:'${task.billCode}'
			},
			dataType:'json',
			success:function(data) {
			    if(data.result==true){
			    	window.location.href = "${ctx}/v2_instorageCount/toCountTaskListPage";
			    }else{
			      alert(data.content);
			      $("button").attr("disabled",false);
                   $("button").attr("class","btn btn-primary");
			    }
			},
			error:function() {
				alert("网络繁忙，请稍后重试...");
				$("button").attr("disabled",false);
                $("button").attr("class","btn btn-primary");
			}
	   });
  }
  
  function back(){
  	window.location.href = "${ctx}/v2_instorageCount/toInstorageCountPageNew/${task.id}";
  }
</script>
</head>

<body>
	<section class="content">
		<div class="row">
			<div class="col-md-12">
				<div class="box box-solid box-primary">
					<div class="box-header">
						<i class="fa fa-list"></i>
						<h3 class="box-title">点收信息<font color='red'>(请仔细核对sku数量是否正确!,确认无误后,完成点收.)</font></h3>
						<div class="box-tools pull-right">
							<button class="btn btn-primary btn-sm" data-widget="collapse"
								type="button">
								<i class="fa fa-minus"></i>
							</button>
						</div>
					</div>
					<div class="box-body">
						<table id="contentTable"
							class="table table-striped table-bordered table-condensed">
							<thead>
								<tr>
									<th>序号</th>
									<th>入库单号</th>
									<th>SKU</th>
									<th>数量</th>
								</tr>
							</thead>
							<tbody>
								<c:if test="${not empty itemList}">
									<c:forEach items="${itemList}" var="dto" varStatus="i">
										<tr>
										   <td>${i.count}</td>
										   <td>${task.billCode}</td>
										   <td>${dto.key}</td>
										   <td>${dto.value}</td>
										</tr>
									</c:forEach>
								</c:if>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<div class="modal-footer bg-gray">
			<input id="finish_btn" class="btn btn-primary" type="button" onclick="finish()" value="完成点收" />
			<input id="cancel_btn" class="btn" type="button" value="返回" onclick="back()" />
		</div>
	</section>
</body>
</html>
